The present invention relates generally to using already developed software of one type with another type of software and more particularly to, a method of integrating preexisting X Windows Intrinsics based toolkits, widgets and the like with JAVA®.
JAVA® is a registered trademark of, and a software development system originated by, Sun Microsystems, Inc., of 901 San Antonio Road, Palo Alto, Calif. 94303, that includes a programming language that is somewhat similar to C and includes extensive development tools along with unique technologies that permit software developers to develop software applications that can be run on many different kinds of computers and operating systems in an attempt to provide a platform-independent development system. Thus, with JAVA, a software developer does not have to include certain code that is specific for the type of computer on which the program will run. As a result, an application written using JAVA can run on different kinds of computers and with different kinds of operating systems. For example, JAVA has been designed so that the same application written in JAVA can be run, largely without any modification whatsoever, on computers that are as different as a PC, a Macintosh computer, a VMX computer, and a Unix computer.
JAVA is relatively young, having been introduced only recently in 1995. Although the number of applications written in JAVA is undoubtedly increasing every day due to its popularity, some other long established development systems have many tried-and-true building-block programs already at their disposal. In developing a JAVA application, it can be desirable to integrate or use at least some of this preexisting software with the application being developed to avoid reinventing the wheel. Using preexisting software advantageously saves time, because it does not need not be ported over to JAVA and debugged, saves money, because so much time is saved, and, in the end, can produce a more robust, feature-filled, and reliable JAVA application.
A visualization toolkit is an example of one type of software that can be integrated into JAVA for this purpose. A visualization toolkit typically includes a suite of simple, yet powerful, object components that are typically used in the development of programs that have two and three dimensional graphic and visualization capabilities as well as programs that handle certain types of input and output. For example, there are a number of visualization and graphics toolkits available for the X Window system, which is a graphics protocol and support system for building graphical user interfaces in Unix and Unix based systems. X Window visualization and graphics toolkits include MOTIF®, GIMP, and VTK, as well as other specialized third party toolkits.
MOTIF® is registered trademark of, and a graphical user interface standard that refers to a publicly licensed toolkit that was developed by, Open Software Foundation, Inc. of 11 Cambridge Center, Cambridge, Mass. 02142, which is also known as The Open Group of 29 Montvale Avenue, Woburn, Mass. 01801. GIMP is an open source toolkit that is also referred to as GTK or GTK+ and is available from www.gtk.org. VTK is an X Window visualization toolkit that is available from Kitware at www.kitware.com.
A visualization and graphics toolkit common to X Window and third party toolkits is the X Window Intrinsics toolkit, which is also referred to as X Toolkit Intrinsics or Xt Intrinsics. This toolkit implements a set of user interface features or application environments that include object components, such as, menus, buttons, labels, scroll bars, scale-bars, drawing areas, and many other things. These object components are typically referred to as Widgets. There other types of Widgets that help manage things that are not necessarily graphical in nature, such as mouse and keyboard events. Using object-oriented techniques, an X Window based application manipulates Widgets provided by or made using the Xt Intrinsics toolkit or another higher level toolkit based on Xt Intrinsics, typically to do something on screen.
The Xt Intrinsics toolkit is also used by programmers to create new Widgets as well as new libraries or toolkits of Widgets. All of the aforementioned third party toolkits that exist and others are based on Xt Intrinsics and some of them are quite specialized. For example, there are toolkits used for processing on-screen graphics, producing 3-D graphics, animating objects, providing graphical analysis of data, and for many other applications.
Xt Intrinsics based visualization and graphics toolkits require an X event loop to provide behind the scenes support for communication between Widgets used by an application and an X Windows' X Server. JAVA does not directly provide any support for Xt Intrinsics and does not provide a method of supporting an X event loop. Past and present solutions to reusing Xt Intrinsics based visualization toolkits within a JAVA application or applet require that the application be separated into client and server processes and have some form of interprocess communication. The client process, called an X Client, provides the basic application structure written in JAVA. The server process, called the X Server, contains the X Windows Intrinsics graphics services, including any desired Widgets, that are made available through interprocess communication. Unfortunately, this solution requires additional development time and effort to provide the interprocess communication and the additional complexity needed to manage the client and server states.
As the following example demonstrates, an invalid state can occur because this limited solution provides no special concurrency control to properly synchronize the X event loop with the JAVA application. Assume that the desired goal of at least a portion of the JAVA application is to cause a 3-dimensional scene to be displayed that rotates continuously at varying rates. Also assume that the native Xt Intrinsics visualization code receives an expose event caused by revealing a window used to display a 3-dimensional scene. This expose event will cause the current 3-dimensional scene to be redrawn. Concurrent to this, the JAVA application requests a schedule camera position change as the 3-dimensional scene is rotated. This will cause a concurrent update of the camera transforms by the JAVA application while the camera transforms are also being read by the X event loop. Unfortunately, the transforms will likely be in an invalid state for the draw that was prompted by the expose event, which can produce an error that halts or otherwise adversely effects execution of the JAVA application. This simple example serves to show that some form of concurrency control is needed for a JAVA application to be able to use preexisting visualization toolkits and components created with such toolkits.
The goal of the present invention is to be able to reuse software components that have already been developed for one type of platform or software development system, namely Xt Intrinsics or Xt Intrinsics based toolkits along with Widgets constructed therefrom, in a JAVA application.
It would therefore be desirable to have a method that makes integrating at least one preexisting Xt Intrinsics based software component into a JAVA application practical and reliable. It would also be advantageous to be able to integrate at least one such preexisting software component into a JAVA application using a method that properly synchronizes the JAVA application and the component. It would also be advantageous to be able provide a method that properly synchronizes the JAVA application and the preexisting software component in a manner that prevents data corruption due to concurrency between the software component and that portion of the JAVA application that calls the software component. It would also be advantageous to be able to provide a method that synchronizes a JAVA application and a preexisting Xt Intrinsics based visualization toolkit. It would also be advantageous to be able to provide a method that synchronizes a JAVA application and a preexisting Xt Intrinsics based visualization toolkit in a manner that prevents data corruption due to concurrency between the X event loop that services the toolkit and a thread or the threads of the JAVA application that make calls to the toolkit.